package timu;
import java.util.Scanner;
import java.util.Random;

public class caishu {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random random = new Random();
        int n = random.nextInt(100);
        System.out.println("请输入您猜测的数字（1-100）：");
        for(int i=0;i>=0;) {
            int a=sc.nextInt();
            if (a == n) {
                i++;
                System.out.println("恭喜您才对了，一共猜了" + i + "次");
                break;
            }else {
                i++;
                if(a<n){
                    System.out.println("您猜小了，请再猜一次");
                } else  {
                    System.out.println("您才猜大了，请再猜一次");
                }
            }
        }
        sc.close();
    }
}
